//引入模块
const fs = require('fs')
const path = require('path')
    //读取文件内容
const data = fs.readFileSync(path.join(__dirname, './infor.json'), 'utf-8')
const data2 = JSON.parse(data)
console.log(data2);
//生成随机数
let num = Math.floor(Math.random() * (data2.length + 1))
console.log(data2[num]);

function add() {
    data2[num].count++

}
add()
console.log(data2[num]);
fs.writeFileSync(path.join(__dirname, './infor.json'), JSON.stringify(data2))